How to use the split () function and the trim () functionThis address: http://blog.csdn.net/caroline_wendy/article/details/24465141Detailed reference Java API: http://docs.oracle.com/javase/6/docs/api/java/lang/String.htmlThe split () function is
The split () function splits a string string, returns an array of string (string[]) based on parameters such as ",", "-", "", and so on, and can specify elements by index.
If not found, the entire string string is returned as the No. 0 element of
The following example illustrates the outofmemoryerror caused by the string substring method:
[Java] view plaincopyprint? Public class testgc {Private string large = new string (New char [2, 100000]);Public String getsubstring (){Return this. Large.
Sun has always admired Sun's rigorous and elegant Technology (bless Sun ). The source code of the Java library in Sun JDK is clear and well-regulated, and the javadoc annotation is used meticulously, which is very familiar and comfortable to read.
Original address: http://jarfield.iteye.com/admin/blogs/583946
Always admired the rigor and elegance of Sun's approach to technology (poor sun). The source code of the Java library in the Sun JDK, even the annotations are clear, the specification
Requirement: divide "01: big car" into 01 and big car
There are two methods: substringJava code
PackageTest;
Public ClassSubstringtest
{
Public Static VoidMain (string ARGs [])
{
String n = "01: Car ";
String L = "";
String r = "";
IntK
Most of the content in this article is taken from the following two articles:
Http://blog.xebia.com/2007/10/04/leaking-memory-in-java /,
Http://www.iteye.com/topic/626801
Use an extreme example to illustrate the outofmemoryerror caused by the string
Today the testers made a small demand, IP address a.b.c.d, abcd any one domain is empty when treated as 0. For example 192 ... , the backstage as 192.0.0.0 processing.The way I think of it is to use the split method of the string, first get the
/*** Take a string which are a delimited list and convert it to a string array. * a Single delimiter can consists of more than one character:it would still * be considered as single delimit Er string, rather than as bunch of potential * delimiter
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.